package cate.game.role.res.guild.po.member;

import cate.common.table.d.GDFunc;
import cate.game.role.Role;
import cate.game.role.RoleSnapshot;
import cate.game.role.res.guild.GuildFuncBase;
import cate.game.role.res.guild.po.GuildPO;
import cate.game.role.res.guild.po.GuildPerformancePO;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "协会成员信息")
public class GuildMemberDetailPO extends GuildFuncBase {
    @NoteField(value = "成员")
    public RoleSnapshot it;
    @NoteField(value = "成员表现")
    public GuildPerformancePO performance;


    @Override
    public void initialize(GuildPO guild) {
        super.initialize(guild);
        if (it == null) {
            it = new RoleSnapshot();
        }
        it.initialize();
        if (performance == null) {
            performance = new GuildPerformancePO();
        }
        performance.initialize(guild);
    }

    public void read(Role role) {
        if (role == null) {
            return;
        }
        it.read(role);
        performance.read(role);
    }

    public void read(RoleSnapshot snap) {
        if (snap == null) {
            return;
        }
        it = snap;
        performance = new GuildPerformancePO(snap);

    }

    public void onDaySpan() {
        if (!it.unreal){
            performance.onDaySpan();
        }
    }

    @Override
    public int getFuncId() {
        return GDFunc.GuildFunc.MEMBER;
    }
}
